<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <title>登陆页面</title>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/vue.min.js"></script>
    <link type="text/css" href="/css/index.css" />
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
</head>
<style>
    body {
        background-color: #EEEEE0;
    }

    .box {
        text-align: center;
        height: 350px;
        margin-top: 10%;
    }

    .row {
        margin-bottom: 30px;
        height: 40px;
    }

    .row input {
        width: 320px;
        height: 40px;
        padding: 0 15px;
        border-radius: 5px;
        border: 1px solid #acacac;
    }

    .row button {
        width: 352px;
        height: 42px;
        background-color: #409eff;
        color: white;
        border-radius: 5px;
        border: 0;
    }

    .row button:hover {
        background-color: teal;
        cursor: pointer;
    }

    .row button:active {
        background-color: green;
        cursor: pointer;
    }

    .lastrow {
        font-size: 14px;
        color: gray;
    }

    .lastrow a {
        text-decoration: none;
        color: #409eff;
    }
</style>
<body>
<div id="vue_det">
    <div class="box">
        <div class="row" >
            <h1>登陆</h1>
        </div>
        <div class="row">
            <input v-model="name" id="name" type="text" placeholder="输入账号"/>

        </div>
        <div class="row">
            <input v-model="password" id="password" type="password" placeholder="输入密码"/>
        </div>
        <div class="row">
            <button id="loginbtn"  @click="post()">登 陆</button>
        </div>
        <div class="row lastrow">
            还没账号?
            <a href="#">免费注册</a>|
            <a href="#">找回密码</a>
        </div>
    </div>
</div>

<p></p>
</body>
</html>
<script type="text/javascript">

    var vm = new Vue({
        el: '#vue_det',
        data: {
            name:"sdsds",
            password:""

        },
        methods: {
            post:function(){
                let params = new URLSearchParams();
                params.append('name', this.name);
                params.append('password', this.password);
                axios.post("/user/login",params)
                    .then(function (response) {
                        if(JSON.stringify(response.data).endsWith(200)){

                            window.location.href = "AdminIndex";
                            alert("密码成功")
                        }


                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            }
        },

    })
</script>